package com.app.acitivty;

import java.util.ArrayList;
import java.util.HashMap;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.webkit.WebView;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ImageView;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.SimpleAdapter;
import android.widget.TextView;

import com.app.activity.R;
import com.app.components.TopMenu;
import com.app.data.InnDetailItem;
import com.app.data.InnItem;
import com.app.service.BaseService;
import com.app.utils.GlobalConstants;

public class InnDetailActivity extends Activity implements OnItemClickListener {

	private ArrayList<HashMap<String, String>> mInnTypeListItems = null;

	private String[] mColumnNames = { "innType", "innPrice" };

	private int[] mViewIds = { R.id.tvInnType, R.id.tvInnPrice };

	private ListView listview;

	public static HashMap addItem(InnDetailItem item) {
		HashMap<Object, Object> map = new HashMap<Object, Object>();
		map.put("innType", item.getInnType());
		map.put("innPrice", item.getInnPrice());
		return map;
	}

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.inn_detail);

		TopMenu topMenu = new TopMenu(this, "客栈列表", new OnClickListener() {

			@Override
			public void onClick(View v) {
				// 跳转到预定客栈页面
				InnDetailActivity.this.finish();
			}
		}, R.drawable.top_button_unselect, R.drawable.top_button_selected, "",80);
		topMenu.onCreate();
		
		InnItem item = GlobalConstants.getInstance().getInnitem();
		
		ImageView imgview =(ImageView)findViewById(R.id.imgInnLogo);
		imgview.setImageBitmap(item.getIconbitmap());
		
		TextView addressView =(TextView)findViewById(R.id.tvAddress);
		addressView.setText(item.getName());
		
		WebView webView =(WebView)findViewById(R.id.tvinnwebView);
		webView.loadDataWithBaseURL(BaseService.url_base, item.getHtmlContent(), "text/html", "utf-8","www.lijiang.com");
	
//		mInnTypeListItems= new ArrayList<HashMap<String, String>>();
// 
//		mInnTypeListItems.add(addItem(new InnDetailItem("商务大床房","￥239")));
//		mInnTypeListItems.add(addItem(new InnDetailItem("经济房","￥139")));
//		mInnTypeListItems.add(addItem(new InnDetailItem("自主大床房","￥290")));
//		mInnTypeListItems.add(addItem(new InnDetailItem("自主双床房","￥123")));
//		mInnTypeListItems.add(addItem(new InnDetailItem("商务大床房","￥444")));
//
//		ListAdapter la = new SimpleAdapter(this, mInnTypeListItems,
//				R.layout.inn_detail_list_item, mColumnNames, mViewIds);
//
//		listview = (ListView) findViewById(R.id.lvInntypeList);
//		listview.setOnItemClickListener(this);
//		listview.setAdapter(la);

	}

	@Override
	public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
		// TODO Auto-generated method stub
		
	}

}
